import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Text, TouchableOpacity, View } from 'react-native';

import HomeScreen from '../screens/main/HomeScreen';
import ProfileScreen from '../screens/main/ProfileScreen';
import SettingsScreen from '../screens/main/SettingsScreen';
import AddStackNavigator from './AddStackNavigator';
import HomeLhx from '../lhx/homeLhx';

const Tab = createBottomTabNavigator();

function MainNavigator() {
  return (
    <Tab.Navigator
      screenOptions={({ route }) => ({
        tabBarIcon: ({ focused, color, size }) => {
          let iconName;

          if (route.name === 'Home') {
            iconName = focused ? '🏠' : '🏠';
          } else if (route.name === 'AddStack') {
            iconName = '➕';
          } else if (route.name === 'Profile') {
            iconName = focused ? '👤' : '👤';
          } else if (route.name === 'Settings') {
            iconName = focused ? '⚙️' : '⚙️';
          } else if (route.name === 'HomeLhx') {
            iconName = '📊';
          } else {
            iconName = '❓';
          }

          return <Text style={{ fontSize: size, color }}>{iconName}</Text>;
        },
        tabBarActiveTintColor: '#007AFF',
        tabBarInactiveTintColor: 'gray',
        tabBarStyle: {
          backgroundColor: '#FFFFFF',
          borderTopWidth: 1,
          borderTopColor: '#E5E5E5',
          paddingBottom: 5,
          paddingTop: 5,
        },
        headerShown: false,
      })}
    >
      <Tab.Screen 
        name="Home" 
        component={HomeScreen}
        options={{
          title: '首页',
          tabBarLabel: '首页'
        }}
      />
      <Tab.Screen 
        name="AddStack" 
        component={AddStackNavigator}
        options={{
          title: '添加',
          tabBarLabel: '添加'
        }}
      />
      <Tab.Screen 
        name="Profile" 
        component={ProfileScreen}
        options={{
          title: '个人中心',
          tabBarLabel: '个人中心'
        }}
      />
      <Tab.Screen 
        name="Settings" 
        component={SettingsScreen}
        options={{
          title: '设置',
          tabBarLabel: '设置'
        }}
      />
       <Tab.Screen 
        name="HomeLhx" 
        component={HomeLhx}
        options={{
          title: '埋点测试',
          tabBarLabel: '埋点测试'
        }}
      />
    </Tab.Navigator>
  );
}

export default MainNavigator; 